#include <iostream>
using namespace std;
/**
 * 实现将Point类型的单例对象创建在静态区的写法，并理解
 */
class Point{
public:
    static Point &getInstance(){
        static Point pt(1,2);
        return pt;
    }
    void print() const{
        cout << "(" << this->_ix
        << "," << this->_iy
        << ")" << endl;
    }
private:
    Point(int x,int y): _ix(x), _iy(y) {
        cout << "Point(int,int)" << endl;
    }
private:
    int _ix;
    int _iy;
};

void test0(){
    Point & pt = Point::getInstance();
    pt.print();

    Point & pt2 = Point::getInstance();
    pt2.print();
    
    cout << &pt << endl;
    cout << &pt2 << endl;
}

int main(int argc, char *argv[]){
    test0();
}
